package com.pjhouse.core.payment.persistence.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.pjhouse.core.common.persistence.IBatisBaseRepository;
import com.pjhouse.core.payment.domain.PaymentDTO;
import com.pjhouse.core.payment.persistence.PaymentRepository;
@Repository("paymentRepository")
public class PaymentRepositoryImpl extends IBatisBaseRepository implements
		PaymentRepository {

	@Override
	public long insert(PaymentDTO pay) {
		return (Long)super.insert("PJ.PAYMENT.insert", pay);
	}

	@Override
	public boolean updateStatus(long id, int status){
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("id", id);
		param.put("status", status);
		return super.update("PJ.PAYMENT.updateStatus", param) == 1;
	}

	@Override
	public PaymentDTO queryById(long id) {
		return (PaymentDTO) super.queryForObject("PJ.PAYMENT.findById", id);
	}

}
